package demoMod.nanaki.patches;

import basemod.ReflectionHacks;
import com.badlogic.gdx.graphics.Color;
import com.evacipated.cardcrawl.modthespire.lib.SpireEnum;
import com.evacipated.cardcrawl.modthespire.lib.SpirePatch;
import com.evacipated.cardcrawl.modthespire.lib.SpireReturn;
import com.megacrit.cardcrawl.ui.DialogWord;
import demoMod.nanaki.NanakiMod;

public class WordColorPatch {
    @SpireEnum
    public static DialogWord.WordColor GREYN;

    @SpirePatch(
            clz = DialogWord.class,
            method = "getColor"
    )
    public static class PatchGetColor{
        public static SpireReturn<Color> Prefix(DialogWord dw){
            Enum wColor = ReflectionHacks.getPrivate(dw, DialogWord.class, "wColor");
            if(wColor.name().equals("GREYN")){
                Color cpy = NanakiMod.GREYN.cpy();
                cpy.a = 1.0F;
                return SpireReturn.Return(cpy);
            }
            return SpireReturn.Continue();
        }
    }

    @SpirePatch(
            clz = DialogWord.class,
            method = "identifyWordColor"
    )
    public static class PatchIdentifyWordColor{
        public static SpireReturn<DialogWord.WordColor> Prefix(String word){
            if(word.charAt(0) == '#' && word.charAt(1) == 'n') {
                return SpireReturn.Return(WordColorPatch.GREYN);
            }
            return SpireReturn.Continue();
        }
    }
}
